from dictionary.model_serializers import DictionaryDetailSerializer
from dictionary.models import DictionaryDetail


class DictionaryMixin:

    @staticmethod
    def get_dictionary_details(dict_key, dict_detail_key):
        """
        获取字典详情
        """
        instance = DictionaryDetail.objects.filter(dict__dict_key=dict_key, dict_detail_key=dict_detail_key,
                                                   is_deleted=False)
        if instance is None:
            return []
        return DictionaryDetailSerializer(instance, many=True).data
